package copyengine.network.roomStructure
{
	import copyengine.dataLayer.sync.CEDataLayerSyncCommandMediator;
	import copyengine.network.chat.CENetworkChatMediator;
	import copyengine.network.roomStructure.data.CENetworkRoomMediatorWhiteBoard;
	import copyengine.network.roomStructure.data.CENetworkRoomNeighbourInfoPackage;
	import copyengine.network.roomStructure.executeLayer.CENetworkRoomExecuteHandleMediator;
	import copyengine.network.roomStructure.subMediator.CENetworkRoomSubCreateJoinMediator;
	import copyengine.network.roomStructure.subMediator.CENetworkRoomSubErrorHandleMediator;
	import copyengine.network.roomStructure.subMediator.CENetworkRoomSubJoinLeaveMediator;
	import copyengine.network.roomStructure.subMediator.CENetworkRoomSubLockUnLockMediator;
	import copyengine.network.roomStructure.subMediator.CENetworkRoomSubQuitMediator;
	import copyengine.network.roomStructure.subMediator.CENetworkRoomSubSendReceiveDataMediator;
	import copyengine.utils.CENestMediatorBasic;
	import copyengine.utils.UUIDFactory;

	import org.puremvc.as3.patterns.mediator.Mediator;

	public final class CENetworkRoomMediator extends CENestMediatorBasic
	{
		private var whiteBoard:CENetworkRoomMediatorWhiteBoard;

		private var chatSocketURL:String;
		private var chatSocketProt:uint;
		private var playerUUID:String

		public function CENetworkRoomMediator(_socketURL:String,
											  _socketProt:uint,
											  _rtmfpURL:String,
											  _chatSocketURL:String,
											  _chatSocketProt:uint,
											  _playerUUID:String)
		{
			whiteBoard = new CENetworkRoomMediatorWhiteBoard();
			whiteBoard.roomNeighbourInfoPackageVector = new Vector.<CENetworkRoomNeighbourInfoPackage>();
			whiteBoard.socketURL = _socketURL;
			whiteBoard.socketProt = _socketProt;
			whiteBoard.rtmfpURL = _rtmfpURL;

			chatSocketURL = _chatSocketURL;
			chatSocketProt = _chatSocketProt;
			playerUUID = _playerUUID;
			super();
		}


		override public function onRegister():void
		{
			registerSubMediator();

		}

		override protected function getSubMediatorArray():Array
		{
			return [
				//聊天服务器
				new CENetworkChatMediator(chatSocketURL, chatSocketProt, playerUUID),
				//子Component
				new CENetworkRoomSubCreateJoinMediator(whiteBoard),
				new CENetworkRoomSubJoinLeaveMediator(whiteBoard),
				new CENetworkRoomSubLockUnLockMediator(whiteBoard),
				new CENetworkRoomSubQuitMediator(whiteBoard),
				new CENetworkRoomSubSendReceiveDataMediator(whiteBoard),
				new CENetworkRoomSubErrorHandleMediator(whiteBoard),
				//底层Executer
				new CENetworkRoomExecuteHandleMediator(),
				//LTC
				new CEDataLayerSyncCommandMediator(),
				];
		}


	}
}
